#ifndef XLCOMM_NET_SOCKETSOPS_H_
#define XLCOMM_NET_SOCKETSOPS_H_

#include <netinet/in.h>
#include <sys/uio.h>

namespace xlcomm {
namespace net {
namespace sockets {

int CreateNonblockSockOrDie();
int GetSocketError(int sockfd);
struct sockaddr GetLocalAddr(int sockfd);
struct sockaddr GetPeerAddr(int sockfd);
bool IsSelfConnect(int sockfd);

ssize_t write(int fd, const void* buf, size_t count);
ssize_t read(int fd, void* buf, size_t count);
ssize_t readv(int fd, const struct iovec* iov, int iovcnt);
int close(int fd);

}  // namespace sockets
}  // namespace net
}  // namespace xlcomm

#endif  // XLCOMM_NET_SOCKETSOPS_H_